/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package memory.GUI;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import memory.Log;

/**
 *
 * @author Scott Robinson
 */
public class ImagePanel extends JPanel {
    
    
    private final String BACKGROUND_IMAGE = "pics\\RodinThinkingMan.jpg";  // location of background
    private final ImageIcon backgroundImage;
    private Log log;
    private final int TITLE_FONT_SIZE = 50;
    private final int HEADING_FONT_SIZE = 30;
    private final int TXT_FONT_SIZE = 20;
    private final int BUFFER_SIZE = 15;
    private final int TIME_SPACING = 170;
    private final int HEADER_SPACING = 60;
    private final int TITLE_SPACING = 35;



    public ImagePanel () {
         backgroundImage = new ImageIcon(getClass().getResource(BACKGROUND_IMAGE));
         resetLog();
    }

    public void resetLog() {
        log = new Log();
    }

     @Override public void paintComponent (Graphics g) {
        super.paintComponent(g);
        backgroundImage.paintIcon(this, g, 0, 0);

        g.setFont(new Font("Lucida Sans Typewriter Bold", Font.BOLD, TITLE_FONT_SIZE));
        g.setColor(Color.ORANGE);
        int counter = BUFFER_SIZE + TITLE_FONT_SIZE;
        g.drawString("Welcome to Memory!", TITLE_SPACING, counter);


        g.setFont(new Font("Lucida Sans Typewriter Bold", Font.BOLD, HEADING_FONT_SIZE));
        counter += HEADING_FONT_SIZE + BUFFER_SIZE;
        g.drawString("Fastest Solutions on Simple", HEADER_SPACING, counter);

//        System.out.println("Testing the SimpleWinners String: ");
//        System.out.println(log.getSimpleWinners());
        g.setFont(new Font("Lucida Sans Typewriter Bold", Font.BOLD, TXT_FONT_SIZE));
        String s[] = log.getSimpleWinners();
        counter += TXT_FONT_SIZE + BUFFER_SIZE;
        g.drawString(s[0], 140, counter);
        counter += TXT_FONT_SIZE + BUFFER_SIZE;
        g.drawString(s[1], 140, counter);
        counter += TXT_FONT_SIZE + BUFFER_SIZE;
        g.drawString(s[2], 140, counter);

        g.setFont(new Font("Lucida Sans Typewriter Bold", Font.BOLD, HEADING_FONT_SIZE));
        counter += HEADING_FONT_SIZE + BUFFER_SIZE;
        g.drawString("Fastest Solutions on Easy", HEADER_SPACING, counter);
        g.setFont(new Font("Lucida Sans Typewriter Bold", Font.PLAIN, TXT_FONT_SIZE));
        s = log.getEasyWinners();
        counter += TXT_FONT_SIZE + BUFFER_SIZE;
        g.drawString(s[0], TIME_SPACING, counter);
        counter += TXT_FONT_SIZE + BUFFER_SIZE;
        g.drawString(s[1], TIME_SPACING, counter);
        counter += TXT_FONT_SIZE + BUFFER_SIZE;
        g.drawString(s[2], TIME_SPACING, counter);

        g.setFont(new Font("Lucida Sans Typewriter Bold", Font.BOLD, HEADING_FONT_SIZE));
        counter += HEADING_FONT_SIZE + BUFFER_SIZE;
        g.drawString("Fastest Solutions on Medium", HEADER_SPACING, counter);
        g.setFont(new Font("Lucida Sans Typewriter Bold", Font.PLAIN, TXT_FONT_SIZE));
        s = log.getMediumWinners();
        counter += TXT_FONT_SIZE + BUFFER_SIZE;
        g.drawString(s[0], TIME_SPACING, counter);
        counter += TXT_FONT_SIZE + BUFFER_SIZE;
        g.drawString(s[1], TIME_SPACING, counter);
        counter += TXT_FONT_SIZE + BUFFER_SIZE;
        g.drawString(s[2], TIME_SPACING, counter);

        g.setFont(new Font("Lucida Sans Typewriter Bold", Font.BOLD, HEADING_FONT_SIZE));
        counter += HEADING_FONT_SIZE + BUFFER_SIZE;
        g.drawString("Fastest Solutions on Hard", HEADER_SPACING, counter);
        g.setFont(new Font("Lucida Sans Typewriter Bold", Font.PLAIN, TXT_FONT_SIZE));
        s = log.getHardWinners();
        counter += TXT_FONT_SIZE + BUFFER_SIZE;
        g.drawString(s[0], TIME_SPACING, counter);
        counter += TXT_FONT_SIZE + BUFFER_SIZE;
        g.drawString(s[1], TIME_SPACING, counter);
        counter += TXT_FONT_SIZE + BUFFER_SIZE;
        g.drawString(s[2], TIME_SPACING, counter);
     }

}
